
package cn.edu.scau.cmi.hombio.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.Calendar;
import java.util.Set;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import org.codehaus.jackson.annotate.JsonIgnore;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllCurePigs", query = "select myCurePig from CurePig myCurePig"),
		@NamedQuery(name = "findCurePigByCureTime", query = "select myCurePig from CurePig myCurePig where myCurePig.cureTime = ?1"),
		@NamedQuery(name = "findCurePigById", query = "select myCurePig from CurePig myCurePig where myCurePig.id = ?1"),
		@NamedQuery(name = "findCurePigByMemo", query = "select myCurePig from CurePig myCurePig where myCurePig.memo = ?1"),
		@NamedQuery(name = "findCurePigByMemoContaining", query = "select myCurePig from CurePig myCurePig where myCurePig.memo like ?1"),
		@NamedQuery(name = "findCurePigByPrimaryKey", query = "select myCurePig from CurePig myCurePig where myCurePig.id = ?1") })

@Table(catalog = "pig", name = "cure_pig")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "pigRs/cn/edu/scau/cmi/hombio/domain", name = "CurePig")

public class CurePig implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	* curetime�Ǿ�������ʱ��
	* 
	 */

	@Column(name = "Id", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@Id @GeneratedValue
	@XmlElement
	Integer id;
	/**
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "CureTime")
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	Calendar cureTime;
	/**
	 */

	@Column(name = "Memo")
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	String memo;

	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "CureTaskCourseId", referencedColumnName = "Id", nullable = false) })
	@XmlTransient
	CureTaskCourse cureTaskCourse;
	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "EmployeeId", referencedColumnName = "Id", nullable = false) })
	@XmlTransient
	Employee employee;
	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "PigId", referencedColumnName = "Id", nullable = false) })
	@XmlTransient
	Pig pig;

	/**
	* curetime�Ǿ�������ʱ��
	* 
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	* curetime�Ǿ�������ʱ��
	* 
	 */
	public Integer getId() {
		return this.id;
	}

	/**
	 */
	public void setCureTime(Calendar cureTime) {
		this.cureTime = cureTime;
	}

	/**
	 */
	public Calendar getCureTime() {
		return this.cureTime;
	}

	/**
	 */
	public void setMemo(String memo) {
		this.memo = memo;
	}

	/**
	 */
	public String getMemo() {
		return this.memo;
	}

	/**
	 */
	public void setCureTaskCourse(CureTaskCourse cureTaskCourse) {
		this.cureTaskCourse = cureTaskCourse;
	}

	/**
	 */
	@JsonIgnore
	public CureTaskCourse getCureTaskCourse() {
		return cureTaskCourse;
	}

	/**
	 */
	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	/**
	 */
	@JsonIgnore
	public Employee getEmployee() {
		return employee;
	}

	/**
	 */
	public void setPig(Pig pig) {
		this.pig = pig;
	}

	/**
	 */
	@JsonIgnore
	public Pig getPig() {
		return pig;
	}

	/**
	 */
	public CurePig() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(CurePig that) {
		setId(that.getId());
		setCureTime(that.getCureTime());
		setMemo(that.getMemo());
		setCureTaskCourse(that.getCureTaskCourse());
		setEmployee(that.getEmployee());
		setPig(that.getPig());
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("id=[").append(id).append("] ");
		buffer.append("cureTime=[").append(cureTime).append("] ");
		buffer.append("memo=[").append(memo).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((id == null) ? 0 : id.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof CurePig))
			return false;
		CurePig equalCheck = (CurePig) obj;
		if ((id == null && equalCheck.id != null) || (id != null && equalCheck.id == null))
			return false;
		if (id != null && !id.equals(equalCheck.id))
			return false;
		return true;
	}
}
